const glob =require('glob')
const fs = require('fs')
let dirs = glob.sync('html/*')
let category = []
dirs.forEach((item, index, dirs) => {
  category.push({category: item.replace('html/', ''), path: item})
})

let dirfiles = []
category.forEach((item, index, category) => {
  let files = glob.sync(item.path + '/**/*.html')
  item.files = files
  dirfiles.push(item)
})
fs.writeFile('dirfiles.json', JSON.stringify(dirfiles), err => {
  if (err) throw err
  console.log('完毕')
})
